home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / configure < prev    next >
Encoding:
Text File  |  1994-04-25  |  14.6 KB  |  496 lines

  1. #!/bin/csh
  2.  
  3. # ****************************************************************************
  4. #  FILE     : configure
  5. #  SHORTNAME: config
  6.  
  7. #  PURPOSE  : Shell scipt to create three make files
  8. #          1) kernel in the directory kernel/source
  9. #          2) X user interface in xgui/source
  10. #          3) tools in tools/source
  11.  
  12. #  AUTHOR   : Tilman Sommer, Niels Mache, Ralf Huebner
  13. #  DATE     : 17.02.92
  14.  
  15. #  MODIFICATIONS : 
  16. #    01.02.91 lines 222-225, 241-256 inserted. (Thomas Korb)
  17. #    22.05.91 some cosmetic changes (A. Zell)
  18. #       25.06.91 line 165 -DSYSTEMV (-> compiler, setbuffer())
  19. #       28.11.91 changes for V1.4: new Makefiles, sun4 dir. renamed to sparc
  20. #                (N. Mache)
  21. #       17.12.91 changes for X11R4: new directory paths (R. Huebner)
  22. #    17.02.92 build all, build compiler commented out (A. Zell)
  23. #    25.02.92 changes for X11R5, installation of RS6000 (R. Huebner)
  24. #    03.03.92 query, if X11 Files not found (R. Huebner)
  25. #    23.03.93 update for version 3.0 (R. Huebner)
  26. #       04.05.93 1) check for $xh/X11/Xaw/Label.h, not only for directory 
  27. #                2) allow 'unknown' for lib and header paths
  28. #                (H. Bayer)
  29. #       13.08.93 Tools options added (R. Huebner)
  30. #       24.08.93 Changes for Solaris (R. Huebner)
  31. #       17.12.93 New dependency checks
  32. #    17.03.94 sgi update (R.Huebner)
  33. #    22.03.94 changed permission for Makefiles (M. Vogt)
  34. #    05.04.94 new bin directory structure, dec alpha update (R.Huebner)
  35. #
  36. #                           (c) 1991 - 94 by SNNS-Group
  37. #             Institute for Parallel and Distributed High Performance Systems
  38. #                             University of Stuttgart, FRG
  39. # ****************************************************************************
  40.  
  41.  
  42.  
  43. echo "************************************************"
  44. echo "*                                              *"
  45. echo "*  SNNS  - Stuttgart Neural Network Simulator  *"
  46. echo "*                                              *"
  47. echo "*          Installation of Version 3.2         *"
  48. echo "*                                              *"
  49. echo "************************************************"
  50. echo ""
  51. echo " - for use with X11R4 or X11R5 and Athena Toolkit"
  52. echo " - needs ansi C-Compiler"
  53. echo " - monochrome and color/grayscale displays"
  54. echo " - on Sun Sparcs, DecStations, RS6000," 
  55. echo "   HP 9000 series, 386/486 PC, Silicon Graphics"
  56. echo "   and (hopefully) other machines"
  57. echo " - It is possible to install SNNS for different types of"
  58. echo "   machines in the same directory."
  59. echo ""
  60. echo -n "Do you really want to create new makefiles? (y/n) [return] > "
  61. set confirm=$<
  62. switch ($confirm)
  63. case y:
  64.     breaksw
  65. default:
  66.     echo "EXIT: snns.make not changed."
  67.     exit 0
  68. endsw
  69. echo ""
  70. echo ""
  71.  
  72. set mfpermission=664
  73.  
  74. if ( -e ./kernel/sources/Makefile) then
  75.     echo -n "kernel  : Copying current Makefile to Makefile.bak ... "
  76.     /bin/cp ./kernel/sources/Makefile ./kernel/sources/Makefile.bak
  77.     echo "Done."
  78. endif
  79. if ( -e ./xgui/sources/Makefile) then
  80.     echo -n "xgui    : Copying current Makefile to Makefile.bak ... "
  81.     /bin/cp ./xgui/sources/Makefile ./xgui/sources/Makefile.bak
  82.     echo "Done."
  83. endif
  84. if ( -e ./compiler/sources/Makefile) then
  85.     echo -n "compiler: Copying current Makefile to Makefile.bak ... "
  86.     /bin/cp ./compiler/sources/Makefile ./compiler/sources/Makefile.bak
  87.     echo "Done."
  88. endif
  89. if ( -e ./tools/sources/Makefile) then
  90.     echo -n "tools   : Copying current Makefile to Makefile.bak ... "
  91.     /bin/cp ./tools/sources/Makefile ./tools/sources/Makefile.bak
  92.     echo "Done."
  93. endif
  94.  
  95.  
  96. cat ./configuration/header >! ./snns.make.tmp
  97. echo "# Created by `logname` at `date`" >> ./snns.make.tmp
  98. echo "" >> ./snns.make.tmp
  99. echo "# -- SNNS  Installation  Directories  &  Libraries --" >> ./snns.make.tmp
  100. echo "" 
  101. echo "For installation, we need the full path to your current directory"
  102. echo "but without auto-mount prefix (like /tmp_mnt/...)"
  103. echo "Current directory:"
  104. echo "        " $cwd
  105. echo -n "Is this your current directory without auto-mount prefix? (y/n) [return] > "
  106. set confirm=$<
  107. switch ($confirm)
  108. case n:
  109.     echo ""
  110.     echo "Please enter the FULL path of your current directory"
  111.     echo "but without auto-mount prefix."
  112.     echo -n "> "
  113.     set rootdir=$<
  114.     breaksw
  115. default:
  116.     set rootdir = `echo $cwd`
  117.     breaksw
  118. endsw
  119.  
  120. echo "SNNSDIR = $rootdir" >> ./snns.make.tmp
  121.  
  122.  
  123. echo ""
  124. echo "Installation directory:"
  125. echo -n "        " $rootdir
  126. echo "/<kernel,xgui,tools>/bin"
  127. echo "         /<sun_os4x,ibm_aix,hp_ux,dec_mips,dec_alpha,"
  128. echo "         sgi_irix,sun_solaris,pc_linux,other"
  129. echo -n "Do you want to change the installation directory ? (y/n) [return] > "
  130. set confirm=$<
  131. switch ($confirm)
  132. case y:
  133.     echo ""
  134.     echo "Please enter the FULL path of your new installation directory"
  135.     echo "but without auto-mount prefix."
  136.     echo -n "> "
  137.     set InstallDir=$<
  138.     breaksw
  139. default:
  140.     set InstallDir
  141.     breaksw
  142. endsw
  143.  
  144.  
  145. # machine #############################################
  146.  
  147. echo ""
  148. echo ""
  149. echo "Select your machine"
  150. echo "  [1] SPARCstation"
  151. echo "  [2] Decstation"
  152. echo "  [3] RS 6000"
  153. echo "  [4] HP 9000"
  154. echo "  [5] Silicon Graphics"
  155. echo "  [6] PC 386/486 Linux"
  156. echo "  [7] Other"
  157. echo -n "Enter number 1-7 > "
  158. set machine=$<
  159. set ldoptions = ( '-L$(XDIR) -lXaw -lXmu -lXt -lXext -lX11 -lm' )
  160. switch ($machine)
  161. case 1:
  162.     echo "MACHINE = sun4" >> ./snns.make.tmp
  163.     set ccflags = "-O"
  164.     set fpoptions = ""
  165.     set thismachine = "sun_os4x"
  166.     set machinename = "Sparc Series"
  167.     breaksw
  168. case 2:
  169.     echo "MACHINE =  dec" >> ./snns.make.tmp
  170.     set ccflags = "-O2 -Olimit 3000 -Dconst=''"
  171.     set fpoptions = "-float"
  172.         set machinename = "Digital DecStation"
  173.     set thismachine = "dec_mips"
  174.     breaksw
  175. case 3:
  176.     echo "MACHINE = RS6000" >> ./snns.make.tmp
  177.     set ccflags = "-O"
  178.     set fpoptions = "-float"
  179.     set machinename = "IBM Risc Station 6000"
  180.     set thismachine = "ibm_aix"
  181.     breaksw
  182. case 4:
  183.     echo "MACHINE = HP9000" >> ./snns.make.tmp
  184.     set ccflags = "-O -Aa -D_HPUX_SOURCE"
  185.     set fpoptions = ""
  186.     set machinename = "Hewlett-Packard Series 9000"
  187.     set thismachine = "hp_ux"
  188.     breaksw
  189. case 5:
  190.     echo "MACHINE = sgi" >> ./snns.make.tmp
  191.     set ccflags = "-O"
  192.     set fpoptions = ""
  193.     set machinename = "Silicon Graphics"
  194.     set thismachine = "sgi_irix"
  195.     breaksw
  196. case 6:
  197.     echo "MACHINE = 386" >> ./snns.make.tmp
  198.     set ccflags = "-O -DSYSTEMV"
  199.     set machinename = "PC System V/386"
  200.     set thismachine = "pc_linux"
  201.     breaksw
  202. default:
  203.     echo "MACHINE = other" >> ./snns.make.tmp
  204.     set ccflags = ""
  205.     set fpoptions = ""
  206.     set machinename = "Unknown"
  207.     set thismachine = "other"
  208.     breaksw
  209. endsw
  210.  
  211.  
  212. echo ""
  213. echo ""
  214.  
  215. # compiler ##########################################
  216.  
  217.  
  218. if ( $thismachine == dec_mips ) then
  219.   echo "Do you have an Alpha Workstation ? (y/n) [return] > "
  220.   set is_alpha=$<
  221.   if ( $is_alpha == y ) then
  222.     set ccflags = "-non_shared -Dconst=''"
  223.     set fpoptions = "-float -ieee_with_inexact"
  224.     set ldoptions = ( $ldoptions "-ldnet_stub" )
  225.     set thismachine = "dec_alpha"
  226.   endif
  227. endif
  228.  
  229. set os = `uname -a`
  230. echo -n "Do you want to use the GNU-C Compiler ? (y/n) [return] > "
  231. set use_gcc=$<
  232. if ( $use_gcc == y ) then
  233.   set compiler = gcc
  234.   set ccflags = "-O4"
  235.   if ( $thismachine == dec_mips ) then
  236.       set ccflags = ( $ccflags -fno-omit-frame-pointer -Dultrix)
  237.   endif
  238.   if ( $thismachine == sgi_irix ) then
  239.       set ccflags = ( $ccflags -w)
  240.   endif
  241.   if ( ( $os[1] == SunOS ) && ($os[3]:r == 5 ) ) then
  242.       set thismachine = "sun_solaris"
  243.   endif
  244.   set fpoptions = ""
  245. else
  246.   set compiler = cc
  247.   if ( ( $os[1] == SunOS ) && ($os[3]:r == 5 ) ) then
  248.       set ccflags = "-O -w"
  249.       set thismachine = "sun_solaris"
  250.   endif
  251. endif
  252.  
  253. if ( $thismachine != pc_linux ) then
  254.     set ldoptions = ( $ldoptions -ll )
  255. endif
  256.  
  257.  
  258. echo "MACHINENAME= $thismachine" >> ./snns.make.tmp
  259.  
  260. echo "COMPILER = $compiler" >> ./snns.make.tmp
  261. echo "CCFLAGS = $ccflags" >> ./snns.make.tmp
  262. echo "FPOPTIONS = $fpoptions" >> ./snns.make.tmp
  263.  
  264. echo ""
  265.  
  266. # ranlib #############################################
  267.  
  268. if ( -e /usr/bin/ranlib ) then
  269.     echo "RLIB = ranlib" >> ./snns.make.tmp
  270. else
  271.     echo "RLIB = echo" >> ./snns.make.tmp
  272. endif
  273.  
  274. echo ""
  275. echo ""
  276.  
  277. # libraries #############################################
  278.  
  279. set xlib = /usr/local/X11R5/lib
  280. while (! -e $xlib/libX11.a )
  281.     echo "X Libraries not found in $xlib"
  282.         echo "Please enter full path of the X11 libraries"
  283.     echo -n "> "
  284.         set xlib=$<
  285.     if ($xlib == "unknown") break
  286. end
  287. echo "X11 libraries located."
  288. echo "XDIR = $xlib" >> ./snns.make.tmp
  289.  
  290. # includes #############################################
  291.  
  292. echo ""
  293. set xh = /usr/local/X11R5/include
  294. while (! -e $xh/X11/Xaw/Label.h )
  295.     echo "X11 include directory is not $xh"
  296.         echo "Please enter full path of the X11 include files"
  297.     echo -n "> "
  298.         set xh=$<
  299.     if ($xh == "unknown") break
  300. end
  301. echo "X11 include directory located."
  302. echo "XH = $xh" >> ./snns.make.tmp
  303.  
  304.  
  305.  
  306. echo ""
  307. echo ""
  308. echo "************************************************"
  309. echo "*                                              *"
  310. echo "*  SNNS  - Stuttgart Neural Network Simulator  *"
  311. echo "*                                              *"
  312. echo "*             selected configuration           *"
  313. echo "*                                              *"
  314. echo "************************************************"
  315. echo ""
  316. echo "Machine: " $machinename
  317. echo ""
  318. echo "Compiler: " $compiler
  319. echo ""
  320. echo "SNNS sources in " 
  321. echo "  1)  $rootdir/kernel/sources"
  322. echo "  2)  $rootdir/xgui/sources"
  323. echo "  3)  $rootdir/tools/sources"
  324. # echo "  3)  $rootdir/compiler/sources"
  325. echo ""
  326. echo "X Windows Version 11 Release 5 "
  327. echo "  libraries in                 " $xlib
  328. echo "  header file directory in     " $xh
  329. echo ""
  330. echo -n "Is this correct ? (y/n) [return] > "
  331. set confirm=$<
  332. switch ($confirm)
  333. case n:
  334.     echo "EXIT: snns.make unchanged."
  335.     /bin/rm -f ./snns.make.tmp
  336.     exit 0
  337. default:
  338.     echo ""
  339.     echo -n "Building makefiles ..."
  340.  
  341. # if ( 0 ) then
  342.  
  343. # Kernel
  344.         set KERNELROOTDIR = $rootdir/kernel/sources
  345.         /bin/cp ./snns.make.tmp $KERNELROOTDIR/Makefile
  346.         cat $rootdir/configuration/kernelstuff >> $KERNELROOTDIR/Makefile
  347. #    cat $rootdir/configuration/depend.kernel >> $KERNELROOTDIR/Makefile
  348.     chmod $mfpermission $KERNELROOTDIR/Makefile
  349.     if (! -d $rootdir/kernel/bin/$thismachine) then
  350.       mkdir $rootdir/kernel/bin/$thismachine
  351.     endif
  352.     if ( $InstallDir != "" ) then
  353.       set bindir = $InstallDir
  354.       if (! -d $bindir)  then
  355.         mkdir $bindir
  356.       endif
  357.     else
  358.           set bindir = $rootdir/kernel/bin/$thismachine
  359.     endif
  360.     echo "s&____&$bindir&g" > $rootdir/configuration/Temp
  361.     sed -f $rootdir/configuration/Temp $KERNELROOTDIR/Makefile > $KERNELROOTDIR/m.new
  362.     /bin/mv  $KERNELROOTDIR/m.new $KERNELROOTDIR/Makefile
  363.     /bin/rm $rootdir/configuration/Temp
  364.     chmod $mfpermission $KERNELROOTDIR/Makefile
  365.  
  366.  
  367.  
  368. # XGUI
  369.         set XGUIROOTDIR = $rootdir/xgui/sources
  370.         echo "LDOPTIONS = $ldoptions" >> ./snns.make.tmp
  371.         /bin/cp ./snns.make.tmp $rootdir/xgui/sources/Makefile
  372.         cat $rootdir/configuration/xguistuff >> $XGUIROOTDIR/Makefile
  373. #    cat $rootdir/configuration/depend.xgui >> $XGUIROOTDIR/Makefile
  374.     if (! -d $rootdir/xgui/bin/$thismachine) then
  375.       mkdir $rootdir/xgui/bin/$thismachine
  376.     endif
  377.     if ( $InstallDir != "") then
  378.       set bindir = $InstallDir
  379.       if (! -d $bindir)  then
  380.         mkdir $bindir
  381.       endif
  382.       echo ""
  383.       echo -n "Copying xgui files: help.hdoc, default.cfg ..."
  384.       /bin/cp $rootdir/xgui/bin/help.hdoc   $InstallDir
  385.       /bin/cp $rootdir/xgui/bin/default.cfg $InstallDir
  386.       echo "Done."
  387.       echo ""
  388.     else
  389.           set bindir = $rootdir/xgui/bin/$thismachine
  390.     endif
  391.     echo "s&____&$bindir&g" > $rootdir/configuration/Temp
  392.     sed -f $rootdir/configuration/Temp $XGUIROOTDIR/Makefile > $XGUIROOTDIR/m.new
  393.     /bin/mv  $XGUIROOTDIR/m.new $XGUIROOTDIR/Makefile
  394.     /bin/rm $rootdir/configuration/Temp
  395.     chmod $mfpermission $XGUIROOTDIR/Makefile
  396.  
  397. # Compiler
  398. #    set COMPILERROOTDIR = $rootdir/compiler/sources
  399. #        /bin/cp ./snns.make.tmp $rootdir/compiler/sources/Makefile
  400. #       cat $rootdir/configuration/compilerstuff >> $COMPILERROOTDIR/Makefile
  401. #    cat $rootdir/configuration/$thismachine.compiler >> $COMPILERROOTDIR/Makefile
  402. #    cat $rootdir/configuration/depend.compiler >> $COMPILERROOTDIR/Makefile
  403. #    if (! -d $rootdir/compiler/bin/$thismachine) then
  404. #      mkdir $rootdir/compiler/bin/$thismachine
  405. #    endif
  406. #    if ( $InstallDir != "") then
  407. #      set bindir = $InstallDir
  408. #      if (! -d $bindir)  then
  409. #        mkdir $bindir
  410. #      endif
  411. #    else
  412. #          set bindir = $rootdir/compiler/bin/$thismachine
  413. #    endif
  414. #    echo "s&____&$bindir&g" > $rootdir/configuration/Temp
  415. #    sed -f $rootdir/configuration/Temp $COMPILERROOTDIR/Makefile > $COMPILERROOTDIR/m.new
  416. #    /bin/mv  $COMPILERROOTDIR/m.new $COMPILERROOTDIR/Makefile
  417. #    /bin/rm $rootdir/configuration/Temp
  418. #    chmod $mfpermission $COMPILERROOTDIR/Makefile
  419.  
  420. # endif
  421.  
  422. # tools
  423.         set TOOLSROOTDIR = $rootdir/tools/sources
  424.         echo "LDOPTIONS = $ldoptions" >> ./snns.make.tmp
  425.         /bin/cp ./snns.make.tmp $rootdir/tools/sources/Makefile
  426.         cat $rootdir/configuration/toolstuff >> $TOOLSROOTDIR/Makefile
  427. #    cat $rootdir/configuration/depend.tools >> $TOOLSROOTDIR/Makefile
  428.     if (! -d $rootdir/tools/bin/$thismachine) then
  429.       mkdir $rootdir/tools/bin/$thismachine
  430.     endif
  431.     if ( $InstallDir != "") then
  432.       set bindir = $InstallDir
  433.       if (! -d $bindir)  then
  434.         mkdir $bindir
  435.       endif
  436.       echo ""
  437.       echo "Done."
  438.       echo ""
  439.     else
  440.           set bindir = $rootdir/tools/bin/$thismachine
  441.     endif
  442.     echo "s&____&$bindir&g" > $rootdir/configuration/Temp
  443.     sed -f $rootdir/configuration/Temp $TOOLSROOTDIR/Makefile > $TOOLSROOTDIR/m.new
  444.     /bin/mv  $TOOLSROOTDIR/m.new $TOOLSROOTDIR/Makefile
  445.     /bin/rm $rootdir/configuration/Temp
  446.     chmod $mfpermission $TOOLSROOTDIR/Makefile
  447.  
  448.  
  449. # END
  450.     /bin/rm -f ./snns.make.tmp 
  451.     echo "Done."
  452.  
  453.  
  454.     echo ""
  455.     echo ""
  456.     echo "************************************************"
  457.     echo "*                                              *"
  458.     echo "*  SNNS  - Stuttgart Neural Network Simulator  *"
  459.     echo "*                                              *"
  460.     echo "************************************************"
  461.     echo ""
  462.     echo "If you start to build SNNS the first time for a new type"
  463.     echo "of machine then first delete all object files with the"
  464.     echo "command:"
  465.     echo "                ./cleanup all"
  466.     echo ""
  467.     echo "Then type:"
  468.     echo ""
  469.     echo "./build all       - to build all SNNS modules"
  470.     echo "./build sim       - to build kernel and xgui"
  471.     echo "./build kernel    - to build kernel only"
  472.     echo "./build xgui      - to build xgui only"
  473.         echo "./build tools     - to build the tools only"
  474. #    echo "./build compiler  - to build the Nessus compiler only"
  475.     echo ""
  476.     if ( $InstallDir != "" ) then
  477.         echo "SNNS will be placed in:"
  478.       echo "$InstallDir"
  479.       echo ""
  480.       echo "All libraries will be placed in:"
  481.     else
  482.       echo "All the relevant binaries will be placed in:"
  483.     endif
  484.     echo "$rootdir/(SNNS module)/bin"
  485.     echo ""
  486.     echo "All examples will be found in:"
  487.     echo "$rootdir/(SNNS module)/examples"
  488.     echo ""
  489.     echo "Remark: You can use ./cleanup with the same parameters"
  490.     echo "        used with the ./build program."
  491.     echo ""
  492.  
  493.     breaksw
  494. endsw
  495.  
  496.